// 头像接口类型
interface DataAvator {
  avator?: string
  time?: number | string
  name?: string
}

// 提问数据接口类型
interface Qs {
  questions: {
    title: string
    picture: string[]
  }
}

// 问题接口数据类型
interface As {
  answers: {
    text: string
    audio?: {
      url: string
      total: number
    }
  }
}
// 交叉类型和联合类型 
type AskConfigList ={asker:DataAvator | Qs ,answer:DataAvator | As} [];
// {
  // asker : DataAvator 融合 Qs
  // answer : DataAvator 融合 As
// }

const arrList: AskConfigList = [
  {
    asker: {
      name: '张三',
      avator: 'https://img.yzcdn.cn/vant/cat.jpeg',
      time: '2020-06-24',
      questions: {
        title: '你是谁',
        picture: [
          'https://img.yzcdn.cn/vant/cat.jpeg',
          'https://img.yzcdn.cn/vant/cat.jpeg',
          'https://img.yzcdn.cn/vant/cat.jpeg',
        ],
      }
    },
    answer: {
      name: '李四',
      avator: 'https://img.yzcdn.cn/vant/cat.jpeg',
      time: '2020-06-24',
      answers: {
        text: '我是李四',
        audio: {
          url: 'https://img.yzcdn.cn/vant/cat.jpeg',
          total: 10,
        }
      }
    },
  },
]


interface Person3 {
  name: string;
  age: number;
  location: string;
}
// keyof : 索引类型 {name:string} // 'name'
// {push : ()=>void pop : , length ,[index :number ]:any}  [].push shift pop unshift slice splice sort reverse filter map reduce every some reduceRight forEach 
type K1 = keyof Person3; //  'name' | 'age' | 'location'
type K2 = keyof Person3[];  // number| push | shift pop unshift slice splice sort reverse filter map reduce every some reduceRight forEach 
type K3 = keyof { [x: string]: Person3 };  // {[x: string]:} {'1':222}

let k1 : K1 = 'name';
let k2 : K2 = 'concat'; // arr[10]
let k3 : K3 = '124'

// koa + mysql + typeorm